package com.boc.langxiang;

import android.app.Application;
import android.graphics.Typeface;

import com.boc.langxiang.manager.UserInfoManager;
import com.tencent.bugly.crashreport.CrashReport;
import com.umeng.socialize.Config;
import com.umeng.socialize.PlatformConfig;

/**
 * CreateTime: 2016-06-23上午10:44
 * Author: wjkjinke00@126.com
 * Description:
 */
public class App extends Application {
    private static App instance;
    private Typeface mSongTypeface;
    private Typeface mOtherTypeface;

    public static App getInstance() {
        return instance;
    }

    {
//        微信
        PlatformConfig.setWeixin(Constant.WEIXIN_APP_ID, Constant.WEIXIN_APP_SECRET);
        //新浪微博
        PlatformConfig.setSinaWeibo(Constant.SINA_APP_ID, Constant.SINA_APP_SECRET);
        Config.REDIRECT_URL = "http://www.bocweb.cn";
        // QQ和Qzone
        PlatformConfig.setQQZone(Constant.QQ_APP_ID, Constant.QQ_APP_SECRET);
    }

    @Override
    public void onCreate() {
        super.onCreate();
        instance = this;

        //bugly
        CrashReport.initCrashReport(getApplicationContext(), Constant.BUGLY_ID, false);

        UserInfoManager.getInstance().initOnApplicationCreate(this);

        if (mSongTypeface == null) {
            mSongTypeface = Typeface.createFromAsset(getAssets(), "fonts/simsun.ttc");
        }
        if (mOtherTypeface == null) {
            mOtherTypeface = Typeface.createFromAsset(getAssets(), "fonts/lang.ttf");
        }
    }

    public Typeface getSongTypeface() {
        return mSongTypeface;
    }

    public Typeface getOtherTypeface() {
        return mOtherTypeface;
    }

}
